﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PressureVersion : SimpleItem_TowSprite
{
    [SerializeField] private InteractiveItems activeInteractiveItem;
    [SerializeField] private InteractiveItems unactiveInteractiveItem;
    private int count = 0;
    public override void Interactive()
    {
        return;
    }
    private void OnCollisionEnter2D(Collision2D collision)
    {

        if (collision.collider.tag.Equals(TagAndLayersConfigs.Tag.Bird))
            return;

        if (count==0)
        {
            Active();
        }
        count++;
    }

    private void OnCollisionExit2D(Collision2D collision)
    {
        if (collision.collider.tag.Equals(TagAndLayersConfigs.Tag.Bird))
            return;
        count--;
        if (count<0)
        {
            count = 0;
        }

        if (count<=0)
        {
            UnActive();
        }
    }

    protected override void Active()
    {
        base.Active();
        activeInteractiveItem.Interactive();
    }
    protected override void UnActive()
    {
        base.UnActive();
        unactiveInteractiveItem.Interactive();
    }




}
